<?php
class Konfigurasi extends Base_model
{
	function __construct()
	{
		parent::__construct();
		$this->init("config","id");				
	}
	
	function get_active()
	{
		$rec = $this->db->select("*")->from($this->table_name)->where("aktif","Y")->get();
		if($rec->num_rows()>0)
		{
			$result = $rec->result();
			return $result[0];
		}
		else
		{
			return FALSE;
		}
	}
	
	function get_logo()
	{
		$rec = $this->get_by_id(1);
		$file = $this->config->item("appdir")."uploads/".$rec->logo;
		if(file_exists($file))
		{
			$mylogo = base_url()."uploads/".$rec->logo;
		}
		else
		{
			$mylogo = base_url()."/assets/images/logo.png";				
		}
		
		return $mylogo;
	}
	
	function get_nama_perusahaan()
	{
		$rec = $this->get_by_id(1);
		return $rec->nama_company;
	}
	
	function get_alamat()
	{
		$rec = $this->get_by_id(1);
		return $rec->alamat;
	}

	function get_kodecabang()
	{
		$rec = $this->get_by_id(1);
		return $rec->kode_cabang;
	}
	
}
?>